# -*- coding:utf-8 -*-
# @FileName  :dhcc_per_reportstructuredlog.py
# @Time      :2020/12/21 10:44
# @Author    :Zhoujirong
# @Desc      :机构化入库管理--需要手工启动jar，打开开关
import parameterized
from common.log import Log
from biz.cases.base_case import BaseCase
from common.params_operator import Param
from biz.flow.per_reportstructuredlog import PerReportStructuredLogRequest

class TestPerReportStructuredLog(BaseCase):
    data_file_name = 'reportstructurelog.yaml'
    @classmethod
    def setUpClass(cls) -> None:
        cls.cookie = BaseCase().get_token()

    @parameterized.parameterized.expand(Param.from_excel('reportstructure_data.xls'))
    def test_get_page(self,curPage,maxSize,search_LIKE_reportId,search_EQ_status,search_EQ_reportType,
                 check,desc):
        self._testMethodDoc = desc
        ret = PerReportStructuredLogRequest.get_page(curPage,maxSize,search_LIKE_reportId,search_EQ_status,
                                                     search_EQ_reportType,self.cookie)
        Log.info(ret)

    def get_page_one(self):
        '''获取入库失败的数据'''
        curPage = self.file_data.get('curPage')
        maxSize = self.file_data.get('maxSize')
        search_LIKE_reportId = self.file_data.get('search_LIKE_reportId')
        search_EQ_status = self.file_data.get('search_EQ_status')
        search_EQ_reportType = self.file_data.get('search_EQ_reportType')
        ret = PerReportStructuredLogRequest.get_page(curPage,maxSize,search_LIKE_reportId,search_EQ_status,
                                                     search_EQ_reportType,self.cookie)
        Log.info(ret)
        return ret.list[0].id


    def test_resubmit(self):
        '''再次入库--需要手工测试，报错忽略'''
        # ids = self.file_data.get('ids')
        ids = self.get_page_one()
        ret = PerReportStructuredLogRequest.resubmit(ids,self.cookie)
        Log.info(ret)
        self.assertEqual('00000000',ret.code)
        self.assertIn('操作成功',ret.msg)






if __name__ == "__main__":
    pass